﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography.X509Certificates;
using NHINDirect;

namespace NHINDirect
{
    public interface IX509Store : IDisposable
    {   
        /// <summary>
        /// Optional criteria that all certificates in this store match
        /// </summary>
        Predicate<X509Certificate2> Criteria
        {
            get;
            set;
        }     
        
        /// <summary>
        /// Locate all certs with the following name (CN=subjectName)
        /// </summary>
        /// <returns>null if not found</returns>        
        X509Certificate2Collection this[string subjectName] { get; }
        
        bool Contains(X509Certificate2 cert);        
            
        void Add(X509Certificate2 cert);
        void Add(IEnumerable<X509Certificate2> certs);
        
        void Remove(X509Certificate2 cert);
        void Remove(IEnumerable<X509Certificate2> certs);

        void Remove(string subjectName);

        void Update(X509Certificate2 cert);
        void Update(IEnumerable<X509Certificate2> certs);
        
        IEnumerable<X509Certificate2> GetCertificates();                
    }        
}
